package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import com.rockcent.mall.lib.domain.enumclass.MarketMerchantCooperationStatus;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * Created by HK on 16/9/5.
 *
 * 商家合作的关系
 */
@Entity
@Table(name = "market_merchant_cooperation")
@DynamicInsert
@DynamicUpdate
public class MarketMerchantCooperation extends IDEntityMall {

    @Column(columnDefinition = "bigint comment '供应商 平台id'")
    private Long supplierMallId;
    @Column(columnDefinition = "bigint comment '供应商 id'")
    private Long supplierMerchantId;
    @Column(columnDefinition = "bigint comment '分销商 平台id'")
    private Long distributorMallId;
    @Column(columnDefinition = "bigint comment '分销商 id'")
    private Long distributorMerchantId;
    @Column(columnDefinition = "varchar(30) comment '状态 WAIT(\"待审核\"), PASS(\"审核通过\"),REFUSE(\"拒绝\")'")
    @Enumerated(EnumType.STRING)
    private MarketMerchantCooperationStatus status;

    public static final String CHECK_TYPE_IS_NOT_NULL = "type 不能为空";
    public static final String CHECK_TYPE_ALLOW = "type 只允许 SUPPLIER(\"供应商\"), DISTRIBUTOR(\"分销商\")";

    public static final String CHECK_SUPPLIER_MERCHANT_ID_IS_NOT_NULL = "supplierMerchantId 不能为空";
    public static final String CHECK_DISTRIBUTOR_MERCHANT_ID_IS_NOT_NULL = "distributorMerchantId 不能为空";

    public Long getSupplierMerchantId() {
        return supplierMerchantId;
    }

    public void setSupplierMerchantId(Long supplierMerchantId) {
        this.supplierMerchantId = supplierMerchantId;
    }

    public Long getDistributorMerchantId() {
        return distributorMerchantId;
    }

    public void setDistributorMerchantId(Long distributorMerchantId) {
        this.distributorMerchantId = distributorMerchantId;
    }

    public MarketMerchantCooperationStatus getStatus() {
        return status;
    }

    public void setStatus(MarketMerchantCooperationStatus status) {
        this.status = status;
    }

    public Long getSupplierMallId() {
        return supplierMallId;
    }

    public void setSupplierMallId(Long supplierMallId) {
        this.supplierMallId = supplierMallId;
    }

    public Long getDistributorMallId() {
        return distributorMallId;
    }

    public void setDistributorMallId(Long distributorMallId) {
        this.distributorMallId = distributorMallId;
    }

    @Override
    public String toString() {
        return "MarketMerchantCooperation{" +
                "supplierMallId=" + supplierMallId +
                ", id=" + id +
                ", supplierMerchantId=" + supplierMerchantId +
                ", dateCreated=" + dateCreated +
                ", distributorMallId=" + distributorMallId +
                ", distributorMerchantId=" + distributorMerchantId +
                ", lastUpdated=" + lastUpdated +
                ", isDelete=" + isDelete +
                ", status=" + status +
                ", version=" + version +
                '}';
    }
}
